package main

import (
	"fmt"
	"net/http"

	"gitee.com/kuma-blog/common"
	"gitee.com/kuma-blog/handlefunc"
)

func main() {
	http.HandleFunc("/", handlefunc.Index)
	http.HandleFunc("/articles", handlefunc.ArticlesIndex)
	http.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {
		http.ServeFile(w, r, "./favicon.ico")
	})
	staticHandle := http.FileServer(http.Dir(common.StaticPath))
	http.Handle("/js/", staticHandle)
	http.Handle("/css/", staticHandle)
	http.Handle("/img/", staticHandle)
	err := http.ListenAndServe(":80", nil)
	if err != nil {
		fmt.Println(err)
	}
}
